package com.dk.controller;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("test")
public class TestRocketMQ {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    @RequestMapping("sendMQ")
    @ResponseBody
    public String sendMQ(){
        //test-topic1 : 消息主题      hello world：发送的消息
        rocketMQTemplate.convertAndSend("test-topic1","hello world");
        return "OK";
    }
}
